package org.eclipse.epsilon.emc.lom;

import java.io.File;

import org.eclipse.epsilon.commons.parse.problem.ParseProblem;
import org.eclipse.epsilon.emc.plainxml.PlainXmlModel;
import org.eclipse.epsilon.eol.EolModule;

public class EolWorkbench {
	
	public static void main(String[] args) throws Exception {
		
		String basePath = "D:/Projects/Eclipse/3.5.1/workspace/org.eclipse.epsilon.emc.lom/scripts/";
		
		// Create EOL module
		EolModule module = new EolModule();
		module.parse(new File(basePath + "test.eol"));
		
		if (module.getParseProblems().size() > 0) {
			for (ParseProblem p : module.getParseProblems()) {
				System.err.println(p.toString());
			}
			return;
		}
		
		// Create sample model
		PlainXmlModel model = new PlainXmlModel();
		model.setName("XML");
		model.setFile(new File(basePath + "library.xml"));
		model.load();
		
		// Create LiveObjectModel
		LiveObjectModel lom = new LiveObjectModel(basePath);
		lom.setName("LOM");
		
		// Associate model with EOL module
		module.getContext().getModelRepository().addModel(model);
		module.getContext().getModelRepository().addModel(lom);
		
		
		module.execute();
		
	}
	
}
